The subject matter generally relates to thread tracing in a run-time environment or Virtual Machine (VM) such as, a Java® Virtual Machine in computer systems. For specific method calls, it is common that several methods are written for generic purposes and are used in various contexts by various threads. If a programmer wishes to trace specific method calls only when a specific thread runs it, there is currently no easy way to do so.
With debugging threads in a non-VM situation, it is common that thread information is gathered/printed when entering a function/method. However, enabling/outputting traces only if a function is executed on a particular thread is not done. However, there are several approaches that employ post processing of the superset trace output to filter out trace entries belonging to specific methods. Unfortunately, these approaches require complex procedures, such as modification of the source code.
In a non-VM situation, consider having C code and wanting to add entry/exit traces to a few functions. In such a case, one has to resort to modifying the source code and recompile or use some binary modification to patch the assembly code to add more logic into the binary to achieve this.